package com.ctsi.ssdc.mapper;

import com.ctsi.ssdc.entity.MinFixedInvestment;
import com.ctsi.ssdc.entity.SubDistrictTownFixedInvestment;
import com.ctsi.ssdc.entity.SubDistrictTownIndustrialInvestment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface FixedInvestmentMapper1 {
    /**
     * @param year 年份
     * @param indicators 指标 (String)
     * @return List<MinFixedInvestment>
     */
    @Select("select month(statisticalTime) `month`,thisMonth,monthOnMonth,accumulate from fixed_investment where indicators = #{indicators}" +
            "and year(statisticalTime) = #{year}")
//    @Select(("select * from fixed_investment where indicators = #{indicators} and year(statisticalTime) = #{year}"))
    List<MinFixedInvestment> findFixedInvestmentByIndicators(@Param("year")int year, @Param("indicators")String indicators);//固投按指标

    @Select("select count(1) from excel_11 where gybj1 != 1 OR gybj1 is NULL\n" +
            "and year(statisticalTime) = #{year} and month(statisticalTime) = #{month}")
    Integer getBasicIndustryInvestmentCount(@Param("year") int year,@Param("month") int month);

    /**
     * @param year 年份
     * @param month 月份 (int)
     * @return List<SubDistrictTownFixedInvestment>
     */
    @Select("select * from sub_district_town_fixed_investment where year(statisticalTime) = #{year} and month(statisticalTime) = #{month} order by monthOnMonth desc")
    List<SubDistrictTownFixedInvestment> findAllSubDistrictTownFixedInvestment(@Param("year")int year,@Param("month") int month);
    /**
     * @param year 年份
     * @param month 月份 (int)
     * @return List<SubDistrictTownIndustrialInvestment>
     */
    @Select("select * from sub_district_town_industrial_investment where year(statisticalTime) = #{year} and month(statisticalTime) = #{month} order by monthOnMonth desc")
    List<SubDistrictTownIndustrialInvestment> findAllSubDistrictTownIndustrialInvestment(@Param("year")int year, @Param("month") int month);

    @Select("select count(*) from excel_11 where gybj1=1 and year(statisticalTime) = #{year} and month(statisticalTime) = #{month}")
    int findIndustrialInvestmentgs(@Param("year")int year,@Param("month") int month);

    @Select("select count(*) from excel_12 where year(statisticalTime) = #{year} and month(statisticalTime) = #{month}")
    int findIndustrialInvestmentfdc(@Param("year")int year,@Param("month") int month);

}